package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.DepartmentDao;
import cn.gson.springboot.model.dao.JobDao;
import cn.gson.springboot.model.mapper.DepartmentMapper;
import cn.gson.springboot.model.mapper.JobMapper;
import cn.gson.springboot.model.pojos.Department;
import cn.gson.springboot.model.pojos.Job;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class JobService {
    @Autowired
    JobMapper jobMapper;
    @Autowired
    JobDao jobDao;

    //查询所有职位
      public List<Job> findAllJob(){
         return jobMapper.findAllJob();
     }

    public List<Job> findDeptJob(Integer deptId){
          return jobMapper.findDeptJob(deptId);
    }

    public void saveJob(Job job){
          jobDao.save(job);
    }

    public void deleteJob(Integer jobId){
          jobDao.deleteById(jobId);
    }

}
